<?php if (!defined('THINK_PATH')) exit();?><!doctype html>
<!doctype html>
<html lang="en">
	<head>
		<meta charset="UTF-8">
		<title><?php echo ($webData["title"]); ?></title>
		<link rel="shortcut icon" href=" __PUBLIC__/Imgs/bitbug_favicon.ico" />
		<link href="__PUBLIC__/Home/Css/header.css" rel="stylesheet" type="text/css" />	
	</head>
	<body>
		<div id="header_top">
<!--			<img src="__ROOT__/Uploads/thumb/th_<?php echo ($webData["logo"]); ?>" style="float:left;" width="150">-->
			<img src="__ROOT__/Uploads/thumb/st.jpg" style="float:left;" width="150">
			<form action="__APP__/Index/searchFoods" method="post">
				<input type="text" id="header_seach" name="fname">
				<input type="submit" id="header_sub" value="搜索">
			</form>

			<ul id="header_ul">
				<li><a href="__APP__/Index/index/">首页</a></li>
				<li><a href="__APP__/Bclass/index/">菜谱分类</a></li>
			</ul>
			<div id="header_login">
			<?php if(empty($_SESSION['uname'])): ?><span>
						<a href="__APP__/Login/login/" target="_blank">
							登录
						</a>
					</span>
					<span>
						<a href="__APP__/Login/reg/" target="_blank">
							注册
						</a>
					</span>
			<?php else: ?>				
				<span>
					<a href="">
					<?php echo (session('uname')); ?>
					</a>
				</span>
				<span>
					<a href="__APP__/Ucenter/index/pass">
					个人中心
					</a>
				</span>
				<span>
					<a href="__APP__/Carts/showCarts/">
					购物车
					</a>
				</span>
				<?php if(!empty($_SESSION['uMsg'])): ?><span>
					<a href="__APP__/Posts/details/form_number/<?php echo (session('uMsg')); ?>" class="clearMsg">
					新订单
					</a>
				</span><?php endif; ?>
				<span style="font-size:14px;">
					<a href="__APP__/Public/loginout/">
					退出
					</a>
				</span><?php endif; ?>
			</div>
		</div>
		<div style="clear:both;height:30px;"></div>
	</body>
</html>
<html lang="en">
	<head>
		<meta charset="UTF-8">
		<title>Document</title>
		<link href="__PUBLIC__/Home/Css/search.css" rel="stylesheet" type="text/css" />
		<script type="text/javascript" src="__PUBLIC__/Js/jquery-1.8.3.js"></script>

		<script type="text/javascript">
			$(function(){
				/*添加到购物车Ajax*/
				$('.addCarts').click(function(){
					
					var fid = $(this).attr('alt');				
					var url = '__APP__/Carts/setCarts/';
					var nowobj = $(this);

					$.post(url,{id:fid},function(cdata){

						if('YES' == cdata.data){
	                                                	
		                                            		nowobj.text('已添加');
		                                        	}else if('NO' == cdata.data){
		                                        		nowobj.text('已存在');                   		
		                                        	}else{                                      		
		                                        		if(!confirm('您还没有登录,去登录吗?')){
	                                    				return false;
	                                				}
		                                        		window.location.href = "__APP__/Login/login";
		                                        	}

					});
				});
			});
		</script>		
	</head>
	<body>
		
		<div id="search_main">
			<div style="width:650px;height:500px;float:left;background:white;">
			<?php if(empty($data)): else: ?>
			<table border="0" cellspacing="0" cellpadding="0">
				<?php if(is_array($data)): $i = 0; $__LIST__ = $data;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?><tr>
						<td width="400">
							<?php echo ($i); ?>.
							<a href="__APP__/Foods/details/id/<?php echo ($vo["id"]); ?>" style="text-decoration:none;color:#992222;font-size:14px;">
								<font color="#B24422"><?php echo ($vo["name"]); ?></font>
							</a>
						</td>
						<td>
							价格：
							<font color="#B24422"><?php echo ($vo["price"]); ?>￥</font>
						</td>
					</tr>
					
					<td colspan="2">
						描述：<?php echo (substr($vo["describe"],0,60)); ?>...
					</td>
					<tr>
						<td>&nbsp;</td>
						<td>&nbsp;</td>
						<td>&nbsp;</td>
					</tr><?php endforeach; endif; else: echo "" ;endif; ?>
			</table><?php endif; ?>
			</div>
		<div id="search_right">
			<?php if(is_array($data)): $i = 0; $__LIST__ = array_slice($data,0,4,true);if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?><div class="advance">
					<a href="__APP__/Foods/details/id/<?php echo ($vo["id"]); ?>" target="__blank">
						<img src="__ROOT__/public/Uploads/<?php echo ($vo["pic"]); ?>" width="160" height="100" />
					</a>
				</div>	
				<div class="detail">
					<br />
					<a href="__APP__/Foods/details/id/<?php echo ($vo["id"]); ?>" target="__blank">
						<font color="#B24422"><?php echo ($vo["name"]); ?></font>
					</a>
					<p color="#B24422">价格：<?php echo ($vo["price"]); ?>￥</p>
					<a alt="<?php echo ($vo["id"]); ?>" class="addCarts">
						+购物车
					</a>
				</div><?php endforeach; endif; else: echo "" ;endif; ?>			
		</div>		
		</div>
		<?php if(!empty($page)): ?><div id="search_page">
			共<?php echo ($page); ?>	
		</div><?php endif; ?>
	</body>
</html>